<template>
  <view class="content">
    <!-- <view class="topbox">
      <view>
        <u-icon @tap="goback" color="#000000" size="40" name="arrow-left"></u-icon>
      </view>
      <view class="topRight"></view>
    </view> -->
    <view class="payon" v-show="paypop == 0">
      <view style="display: flex;align-items:center;">
        <image src="../static/image/pagesDelivery/await.png" mode="scaleToFill" />
        <view>待支付</view>
      </view>
      <view style="display:flex;align-items:center;">
        <text style="font-size: 28rpx;color: #D12C25;margin-right:8rpx;">00:14:00</text>
        <image style="width: 24rpx; height:24rpx;" src="../static/image/pagesDelivery/prompt.png" mode="scaleToFill" />
      </view>
    </view>
    <view style="justify-content: space-between;" class="payon" v-show="paypop == 1">
      <view style="display: flex; align-items: center;">
        <image src="../static/image/pagesDelivery/carryout.png" mode="scaleToFill" />
        <view>物流派送中</view>
      </view>

    </view>
    <view class="payon" v-show="paypop == 2">
      <view style="display: flex; align-items:center;">
        <image src="../static/image/pagesDelivery/perfectImg.png" mode="scaleToFill" />
        <view>已完成</view>
      </view>
      <view @tap="gotocomments" style="display:flex;align-items:center;">
        <text style="font-size: 28rpx;color: #D12C25;margin-right:8rpx;">购买完未评价，去评论</text>
        <u-icon name="arrow-right" color="#D12C25" size="28"></u-icon>
      </view>
    </view>
    <view class="payon" v-show="paypop == 3">
      <view style="display: flex; align-items:center;">
        <image style="width: 64rpx;" src="../static/image/pagesDelivery/refund.png" mode="scaleToFill" />
        <view>退款中</view>
      </view>
      <view style="display:flex;align-items:center;">
        <text style="font-size: 28rpx;color: #D12C25;margin-right:8rpx;">00:14:00</text>
        <image style="width: 24rpx; height:24rpx;" src="../static/image/pagesDelivery/prompt.png" mode="scaleToFill" />
      </view>
    </view>
    <view v-show="paypop == 3" style="margin-top: 60rpx;">
      <u-steps :list="numList" :current="1" mode="number" active-color="#16D356"></u-steps>
    </view>
    <view style="display: flex;align-items:flex-end;" v-show="paypop == 4">
      <view class="payontwo">
        <image src="../static/image/pagesDelivery/refundEnd.png" mode="scaleToFill" />
        <view>退款已取消</view>
      </view>

    </view>
    <view v-show="paypop == 4" style="font-weight: 400;font-size: 28rpx;color: #D12C25;margin-left:20rpx;">
      拒绝原因:商家拒绝退款
    </view>
    <view v-show="paypop == 4" style="margin-top: 60rpx;">
      <u-steps :list="numList" :current="0" mode="number" active-color="#16D356" un-active-color="red"></u-steps>
    </view>
    <view style="display: flex;align-items:flex-end;" v-show="paypop == 5">
      <view class="payontwo">
        <image src="../static/image/pagesDelivery/perfectImg.png" mode="scaleToFill" />
        <view>退款已完成</view>
      </view>
    </view>
    <view v-show="paypop == 5" style="margin-top: 60rpx;">
      <u-steps :list="numList" :current="2" mode="number" active-color="#16D356"></u-steps>
    </view>
    <view class="payon" v-show="paypop == 6">
      <view style="display: flex;align-items:center;">
        <image src="../static/image/pagesDelivery/await.png" mode="scaleToFill" />
        <view>待商家接单</view>
      </view>
      <view style="display:flex;align-items:center;">
        <text style="font-size: 28rpx;color: #D12C25;margin-right:8rpx;">00:14:00</text>
        <image style="width: 24rpx; height:24rpx;" src="../static/image/pagesDelivery/prompt.png" mode="scaleToFill" />
      </view>
    </view>
    <view class="payon" v-show="paypop == 7">
      <view style="display: flex; align-items:center;">
        <image src="../static/image/pagesDelivery/timeOut.png" mode="scaleToFill" />
        <view>订单已失效</view>
      </view>
      <view style="display:flex;align-items:center;">
        <text style="font-size: 28rpx;color: orange;margin-right:8rpx;">订单超时，已自动退款</text>
        <image style="width: 24rpx; height:24rpx;" src="../static/image/pagesDelivery/prompt.png" mode="scaleToFill" />
      </view>
    </view>
    <view class="address">
      <view class="addressone">
        <view style="margin-right:24rpx;">小王</view>
        <view>17605277797</view>
      </view>
      <view class="addresstwo">
        <view style="margin-right:24rpx;">
          <u-icon color="#000000" size="40" name="map-fill"></u-icon>
        </view>
        <view>天津城市蓟州区中南新村</view>
      </view>
    </view>
    <view class="ordersmain">
      <view class="ordermainone">
        <view class="orderleft">百果园（蓟县创业街店）</view>

        <view @tap="show = true" v-show="paypop == 0" class="orderright">修改信息</view>
        <view @tap="showorders = true" v-show="paypop == 6" class="orderright">取消订单</view>
        <view @tap="godeliveryback" v-show="paypop == 2" class="orderright">申请退款</view>
        <view v-show="paypop == 3" class="orderright"><text style="color:orange;">申请退款中</text></view>
      </view>
      <view class="ordermaintwo" v-for="(item, index) in shoplist" :key="index">
        <view>
          <image :src="item.img" mode="scaleToFill" />
        </view>
        <view style="flex: 1;">
          <view class="ordertwoname">{{ item.name }}</view>
          <view class="ordertwonum">
            <text class="ordertwotop">x{{ item.shopnum }}</text>
            <view>
              <text class="ordertwobottom">￥</text>
              <text class="orderbottomtwo">{{ item.price * item.shopnum }}</text>
            </view>
          </view>
        </view>
      </view>
      <view style="font-weight: 400;font-size: 32rpx;color: #999999;margin-top:24rpx;" v-show="paypop == 3 || paypop == 5">
        物流费￥40
      </view>
      <view class="pay">
        <view>支付方式</view>
        <view style="display:flex; align-items:center;">
          <view style="display:flex; align-items:center;">
            <image src="../static/image/pagesDelivery/alipay.png" mode="scaleToFill" />
          </view>
          <view style="font-weight: 600; color: #424141;">
            <text>支付宝</text>
          </view>
        </view>
      </view>

      <view v-show="paypop == 0 || paypop == 1 || paypop == 2 || paypop == 7" @tap="remark" class="remark">
        <view>
          <view>备注：</view>
        </view>
        <view style="display:flex;">
          <view
            style="margin-right:24rpx; width:200rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align:right;">
            <text>{{ value }}</text>
          </view>
          <view>
            <image style="width:20rpx;height:32rpx;" src="../static/image/pagesDelivery/right.png" mode="scaleToFill" />
          </view>
        </view>
      </view>
    </view>
    <view class="ordersnum">
      <view class="ordersone">
        <view>订单编号</view>
        <view>
          adasdasdawdd
          <text style="padding:6rpx 12rpx; background-color:#F3F3F3; color:#333333; margin-left:24rpx;">复制</text>
        </view>
      </view>
      <view class="ordersone">
        <view>下单时间</view>
        <view>2024.06.18 09:48</view>
      </view>
      <view v-show="paypop == 3 || paypop == 4 || paypop == 5" class="ordersone">
        <view>支付时间</view>
        <view>2024.06.18 09:48</view>
      </view>
      <view v-show="paypop == 3 || paypop == 4 || paypop == 5" class="ordersone">
        <view>申请退款时间</view>
        <view>2024.06.18 09:48</view>
      </view>

      <view class="ordersone">
        <view>订单金额</view>
        <view style="color: #D12C25;">￥{{ shoplist[0].price * shoplist[0].shopnum }}</view>
      </view>
      <view v-show="paypop == 1 || paypop == 2 || paypop == 3 || paypop == 4 || paypop == 5" class="ordersone">
        <view>物流单号</view>
        <view>4849494749494791 <text
            style="background-color: #F3F3F3; color:#333333; padding: 6rpx 12rpx;margin-left:24rpx;">复制</text>
        </view>
      </view>
      <view class="ordersone">
        <view>联系商家</view>
        <view>
          <u-icon color="#D12C25" name="phone-fill"></u-icon>
        </view>
      </view>
      <view v-show="paypop == 3 || paypop == 4 || paypop == 5" class="ordersone">
        <view>退款单号</view>
        <view>4849494749494791 <text
            style="background-color: #F3F3F3; color:#333333; padding: 6rpx 12rpx;margin-left:24rpx;">复制</text>
        </view>
      </view>
      <view v-show="paypop == 3 || paypop == 4 || paypop == 5" class="ordersone">
        <view>退款原因</view>
        <view>
          都烂掉了
        </view>
      </view>
      <view class="ordersone" v-show="paypop == 3 || paypop == 4">
        退款图片
      </view>
      <view v-show="paypop == 3 || paypop == 4 || paypop == 5" class="ordersone">
        <view>
          <image style="width:156rpx; height:132rpx; border-radius: 12rpx;"
            src="https://tse2-mm.cn.bing.net/th/id/OIP-C.IfSNv6ECRESLePJIM5MIBgHaEz?w=243&h=180&c=7&r=0&o=5&pid=1.7"
            mode="scaleToFill" />
        </view>
      </view>
    </view>


    <view class="gotopay" v-show="paypop == 0">
      <text>去支付</text>
    </view>
    <view class="gotopaytwo" v-show="paypop == 3">
      <text>撤销退款</text>
    </view>
    <view class="gotopaytwo" v-show="paypop == 4">
      <text>重新申请</text>
    </view>
    <u-modal style="z-index:999999999" v-model="showinput" :show-title="false">
      <view style="padding: 20rpx; ">
        <u-input v-model="value" :type="type" :border="border" :height="height" :auto-height="autoHeight" />
      </view>
    </u-modal>
    <view>
      <u-popup v-model="show" mode="bottom">
        <view style="background:linear-gradient( 180deg, #FFFFFF 6%, #F5F5F5 25%);padding:0 32rpx 328rpx 32rpx;">
          <view class="address">
            <view class="addressone">
              <view style="margin-right:24rpx;">小王</view>
              <view>17605277797</view>
            </view>
            <view style="display: flex; justify-content: space-between; align-items: center;">

              <view>天津城市蓟州区中南新村</view>
              <view style="margin-right:24rpx;">
                <u-icon color="#000000" size="30" name="arrow-right"></u-icon>
              </view>
            </view>
          </view>
          <view class="ordersmain">
            <view class="ordermainone">
              <view class="orderleft">百果园（蓟县创业街店）</view>
              <view v-show="paypop == 6" class="orderright">商家自送</view>
              <view v-show="paypop == 0" class="orderright">修改信息</view>

            </view>
            <view class="ordermaintwo" v-for="(item, index) in shoplist" :key="index">
              <view>
                <image :src="item.img" mode="scaleToFill" />
              </view>
              <view style="flex: 1;">
                <view class="ordertwoname">{{ item.name }}</view>
                <view class="ordertwonum">
                  <text class="ordertwotop">x{{ item.shopnum }}</text>
                  <view>
                    <text class="ordertwobottom">￥</text>
                    <text class="orderbottomtwo">{{ item.price * item.shopnum }}</text>
                  </view>
                </view>
              </view>
            </view>

            <view class="pay">
              <view>支付方式</view>
              <view style="display:flex; align-items:center;">
                <view style="display:flex; align-items:center;">
                  <image src="../static/image/pagesDelivery/alipay.png" mode="scaleToFill" />
                </view>
                <view style="font-weight: 600; color: #424141;">
                  <text>支付宝</text>
                </view>
              </view>
            </view>
            <view @tap="remark" class="remark">
              <view>
                <view>备注：</view>
              </view>
              <view style="display:flex;">
                <view
                  style="margin-right:24rpx; width:200rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align:right;">
                  <text>{{ value }}</text>
                </view>
                <view>
                  <image style="width:20rpx;height:32rpx;" src="../static/image/pagesDelivery/right.png"
                    mode="scaleToFill" />
                </view>
              </view>
            </view>
          </view>
          <view class="gotoEndPay">
            <view>
              <view>
                <text style="font-size: 32rpx;">￥</text>
                <text style="font-size: 40rpx;">{{ shoplist[0].price * shoplist[0].shopnum }}</text>

              </view>

            </view>
            <view @tap="gotoendpay" class="gotoright">支付订单</view>
          </view>
        </view>
      </u-popup>
    </view>
    <view>
      <u-popup v-model="showorders" mode="bottom">
        <view style="padding:32rpx 32rpx 224rpx 32rpx;">
          <view style="font-weight: bold;font-size: 28rpx;color: #000000;">
            订单取消
          </view>
          <view class="radio">
            请选择取消订单原因
          </view>
          <view class="">
            <u-radio-group :wrap="true" v-model="valuerradio" @change="radioGroupChange">
              <u-radio class="radiobutton" active-color="red" @change="radioChange" v-for="(item, index) in list"
                :key="index" :name="item.name" :disabled="item.disabled">
                {{ item.name }}
              </u-radio>
            </u-radio-group>
          </view>
        </view>
        <view @tap="showorders = false" class="gotoradio">
          <text>确认</text>
        </view>
      </u-popup>
    </view>
  </view>

</template>

<script>
let that = null;
export default {
  data() {
    return {
      shoplist: [
        {
          id: "0",
          img:
            "https://img2.baidu.com/it/u=3597756135,179698068&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1718902800&t=24043e4e9fb78f26c6f85e62aa0f87c2",
          name: "好西瓜好西瓜好西瓜好西瓜好西瓜好西瓜",
          num: 50,
          price: 12,
          rightType: false,
          shopnum: 2,

        }
      ],
      //取消订单选择
      list: [
        {
          name: '价格有点贵',
          disabled: false
        },
        {
          name: '买错了',
          disabled: false
        },
        {
          name: '收货地址选错',
          disabled: false
        },
        {
          name: '暂时不需要了',
          disabled: false
        },
        {
          name: '其他',
          disabled: false
        }
      ],
      numList: [
        {
          name: '已申请退款'
        },
        {
          name: '待确认退款'
        },
        {
          name: '待退款到账'
        },

      ],
      valuerradio: 'orange',
      addlist: [],
      paypop: 2,
      showinput: false,
      value: "",
      type: "textarea",
      border: true,
      height: 100,
      autoHeight: true,
      show: false,
      showorders: false,
      showpinjie: 'L5WLuJGu7j_HXZX1819300931792146432'
    };
  },
  onLoad() {
    that = this;
    const eventChannel = that.getOpenerEventChannel();
    // 监听redactInfo事件，获取上一页面通过eventChannel传送到当前页面的数据
    eventChannel.on("redactInfo", function (data) {
      console.log("获取到信息", data.shoplist);
    });
  },
  methods: {
    goback() {
      uni.navigateBack({
        delta: 1
      });
    },
    remark() {
      if (this.paypop == 0) {
        console.log(111);
        this.showinput = true;
      }
    },
    gotoendpay() {

    },
    // 选中某个单选框时，由radio时触发
    radioChange(e) {
      // console.log(e);
    },
    // 选中任一radio时，由radio-group触发
    radioGroupChange(e) {
      // console.log(e);
    },
    gotocomments() {
      uni.navigateTo({
        url: '/pagesHealth/healthComments',
      })
    },
    godeliveryback() {
      uni.navigateTo({
        url: '/pagesHealth/healthBackDetail',
      })
    }
  }
};
</script>

<style scoped lang="scss">
.content {
  min-height: 100vh;
  width: 100vw;
  background-color: #e6e6e6;
  display: flex;
  flex-direction: column;
  padding: 0 32rpx calc(180rpx + env(safe-area-inset-bottom)) 32rpx;

  .topbox {
    display: flex;
    justify-content: space-between;
    margin-top: 114rpx;

    .topRight {
      display: flex;
      justify-content: space-between;
      width: 168rpx;

      image {
        width: 40rpx;
        height: 40rpx;
      }

      .moreimg {
        margin-top: 12rpx;
        width: 36rpx;
        height: 12rpx;
      }
    }
  }

  .payon {
    display: flex;
    align-items: center;
    margin-top: 48rpx;
    margin-left: 24rpx;
    height: 68rpx;
    font-family: PingFang SC, PingFang SC;
    font-weight: bold;
    font-size: 48rpx;
    color: #000000;
    justify-content: space-between;

    image {
      margin-right: 24rpx;
      width: 48rpx;
      height: 48rpx;
    }
  }

  .payontwo {
    display: flex;
    align-items: center;
    margin-top: 48rpx;
    margin-left: 24rpx;
    height: 68rpx;
    font-family: PingFang SC, PingFang SC;
    font-weight: bold;
    font-size: 48rpx;
    color: #000000;

    image {
      margin-right: 24rpx;
      width: 48rpx;
      height: 48rpx;
    }
  }

  .address {
    background: white;
    border-radius: 12rpx;
    margin-top: 28rpx;
    padding: 32rpx 0 24rpx 32rpx;
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 28rpx;
    color: #000000;

    .addressone {
      display: flex;
      justify-content: start;
      margin-bottom: 24rpx;
      align-items: center;
    }

    .addresstwo {
      display: flex;
      justify-content: start;
      align-items: center;
    }
  }

  .ordersmain {
    border-radius: 12rpx 12rpx 12rpx 12rpx;
    padding: 32rpx 22rpx;
    background-color: white;
    margin: 18rpx 0;
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 32rpx;
    color: #000000;

    .ordermainone {
      display: flex;
      justify-content: space-between;

      .orderleft {
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        font-size: 32rpx;
        color: #000000;

        font-style: normal;
      }

      .orderright {
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        font-size: 28rpx;
        color: #d12c25;

        font-style: normal;
      }
    }

    .ordermaintwo {
      display: flex;
      margin-top: 18rpx;

      image {
        width: 156rpx;
        height: 132rpx;
      }

      .ordertwoname {
        padding: 0 0 38rpx 24rpx;
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        font-size: 32rpx;
        color: #000000;
        line-height: 38rpx;
        font-style: normal;
      }

      .ordertwonum {
        display: flex;
        justify-content: space-between;
        padding-left: 24rpx;
        align-items: center;

        .ordertwotop {
          font-family: PingFang SC, PingFang SC;
          font-weight: 400;
          font-size: 26rpx;
          color: #999999;
        }

        .ordertwobottom {
          font-family: PingFang SC, PingFang SC;
          font-weight: bold;
          font-size: 28rpx;
          color: #ff0000;
        }

        .orderbottomtwo {
          font-family: PingFang SC, PingFang SC;
          font-weight: bold;
          font-size: 40rpx;
          color: #ff0000;
        }
      }
    }

    .Distribution {
      margin-top: 18rpx;
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 32rpx;
      color: #999999;

      font-style: normal;
    }

    .pay {
      margin-top: 18rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 32rpx;
      color: #000000;
      font-style: normal;

      image {
        width: 36rpx;
        height: 36rpx;
        margin-right: 14rpx;
      }
    }

    .remark {
      display: flex;
      justify-content: space-between;
      margin-top: 18rpx;
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 32rpx;
      color: #000000;
      align-items: center;
    }
  }

  .ordersnum {
    padding: 0 24rpx 32rpx 24rpx;
    background-color: white;
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 28rpx;
    color: #000000;
    border-radius: 12rpx;

    .ordersone {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 24rpx;
    }
  }



  .gotoEndPay {
    width: 90%;
    height: 96rpx;
    background: #333333;
    border-radius: 176rpx;
    display: flex;
    justify-content: space-between;
    line-height: 96rpx;
    color: white;
    padding-left: 48rpx;
    position: fixed;
    bottom: 66rpx;

    .gotoright {
      width: 24%;
      background: linear-gradient(270deg, #d12c25 0%, #d12c25 100%);
      border-radius: 0 176rpx 176rpx 0;
      text-align: center;
      line-height: 96rpx;
      color: white;
    }
  }

  .gotopay {
    text-align: center;
    padding: 26rpx 294rpx;
    background-color: #D12C25;
    color: white;
    border-radius: 1998rpx;
    position: fixed;
    bottom: 64rpx;
    font-weight: bold;
    font-size: 32rpx;
  }

  .gotopaytwo {
    text-align: center;
    padding: 26rpx 278rpx;
    background-color: #D12C25;
    color: white;
    border-radius: 1998rpx;
    position: fixed;
    bottom: 64rpx;
    font-weight: bold;
    font-size: 32rpx;
  }

  .radio {
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 28rpx;
    color: #999999;
    margin: 24rpx 0;
  }

  .radiobutton {
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 28rpx;
    color: #999999;
    margin-bottom: 72rpx;
    display: flex;
    // justify-content: space-between;
  }

  .gotoradio {
    text-align: center;
    padding: 26rpx 310rpx;
    background-color: #D12C25;
    color: white;
    border-radius: 1998rpx;
    position: fixed;
    bottom: 64rpx;
    left: 32rpx;
    font-weight: bold;
    font-size: 32rpx;
  }

  ::v-deep .u-line {
    border-bottom: 1px solid black !important;
  }
}
</style>